package com.foreveross.crawl.dto;

import java.util.ArrayList;
import java.util.List;

import com.foreveross.crawl.vo.TaskModelBeta1;

public class TaskModelDto extends TaskModelBeta1 {

	/**
	 * 
	 */
	private static final long serialVersionUID = 2959506032941663481L;
	
	private String jobName;
	private String groupName;
	private String taskState;
	/**
	 * 任务轨迹
	 */
	private List<String> tracksList = new ArrayList<String>();

	public TaskModelDto() {
//		super();
	}

	/**
	 * 因为新增了页面编码，发布时间   故废弃该构造方法
	 * @param id 任务ID
	 * @param channelId 渠道ID
	 * @param channelName 渠道名称
	 * @param isProxyIp 是否使用代理IP
	 * @param praramterJson JSON字符串
	 * @param metadata	praramterJson的元数据
	 * @param taskStartDate 任务开始执行时间
	 * @param taskEndDate 任务结束执行时间
	 * @param jobName 任务名称
	 * @param groupName 任务组名称
	 * @param taskState 任务状态
	 */
	@Deprecated
	public TaskModelDto(String id, Long channelId, String channelName,
			Long isProxyIp, String praramterJson, String metadata,
			String taskStartDate, String taskEndDate, String jobName,
			String groupName, String taskState) {
		super(id, channelId, channelName, isProxyIp, praramterJson, metadata,
				taskStartDate, taskEndDate);
		this.jobName = jobName;
		this.groupName = groupName;
		this.taskState = taskState;
	}
	
	/**
	 * /**
	 * @param id 任务ID
	 * @param channelId 渠道ID
	 * @param channelName 渠道名称
	 * @param isProxyIp 是否使用代理IP
	 * @param praramterJson JSON字符串
	 * @param metadata	praramterJson的元数据
	 * @param taskStartDate 任务开始执行时间
	 * @param taskEndDate 任务结束执行时间
	 * @param jobName 任务名称
	 * @param groupName 任务组名称
	 * @param taskState 任务状态
	 * @param encoded 页面编码方式
	 * @param taskPublish 任务发布时间
	 */
	public TaskModelDto(String id, Long channelId, String channelName,
			Long isProxyIp, String praramterJson, String metadata,
			String taskStartDate, String taskEndDate, long taskExcuteTotal, String jobName,
			String groupName, String taskState, String encoded, String taskPublish, String proxyIp, int taskType, List<String> tracksList) {
		super(id, channelId, channelName, isProxyIp, praramterJson, metadata,
				taskStartDate, taskEndDate, taskExcuteTotal, encoded, taskPublish, proxyIp, taskType);
		this.jobName = jobName;
		this.groupName = groupName;
		this.taskState = taskState;
		this.tracksList = tracksList;
	}

	public String getJobName() {
		return jobName;
	}

	public void setJobName(String jobName) {
		this.jobName = jobName;
	}

	public String getGroupName() {
		return groupName;
	}

	public void setGroupName(String groupName) {
		this.groupName = groupName;
	}

	public String getTaskState() {
		return taskState;
	}

	public void setTaskState(String taskState) {
		this.taskState = taskState;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = super.hashCode();
		result = prime * result
				+ ((groupName == null) ? 0 : groupName.hashCode());
		result = prime * result + ((jobName == null) ? 0 : jobName.hashCode());
		result = prime * result
				+ ((taskState == null) ? 0 : taskState.hashCode());
		result = prime * result
				+ ((tracksList == null) ? 0 : tracksList.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (!super.equals(obj))
			return false;
		if (getClass() != obj.getClass())
			return false;
		TaskModelDto other = (TaskModelDto) obj;
		if (groupName == null) {
			if (other.groupName != null)
				return false;
		} else if (!groupName.equals(other.groupName))
			return false;
		if (jobName == null) {
			if (other.jobName != null)
				return false;
		} else if (!jobName.equals(other.jobName))
			return false;
		if (taskState == null) {
			if (other.taskState != null)
				return false;
		} else if (!taskState.equals(other.taskState))
			return false;
		if (tracksList == null) {
			if (other.tracksList != null)
				return false;
		} else if (!tracksList.equals(other.tracksList))
			return false;
		return true;
	}

	@Override
	public String toString() {
		return "TaskModelDto [jobName=" + jobName + ", groupName=" + groupName
				+ ", taskState=" + taskState + ", tracksList=" + tracksList
				+ "]";
	}

	public List<String> getTracksList() {
		return tracksList;
	}

	public void setTracksList(List<String> tracksList) {
		this.tracksList = tracksList;
	}
}
